package hit.example.clipbroad;


import java.util.ArrayList;

import hit.example.Object.ObjWord;
import hit.example.adapter.AdapterListView;
import hit.example.hitdict.R;
import hit.example.home.MyFragment;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

@SuppressLint("NewApi")
public class ListClipbroadFm extends MyFragment {
	static ArrayList<ObjWord> listWordView;
	ListView lv;
	
	AdapterListView adp;

	public ListClipbroadFm(ArrayList<ObjWord> list) {
		super();
		listWordView=list;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View root=inflater.inflate(R.layout.fm_listword, container,false);
		return root;
	}
	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onViewCreated(view, savedInstanceState);
		lv=(ListView)view.findViewById(R.id.lvDanhSachtu);
		
	}
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		adp=new AdapterListView(getActivity(), R.layout.custom_listview_item, listWordView);
		lv.setAdapter(adp);
		lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int position,
					long arg3) {
				ActivityClipbroad.getInstance().pushDetail(listWordView.get(position), 2);
			}
		});
		
		
	}
}
